{extend name="property/public/insidePageBase" /}
{block name="title"}抄送至我的{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-inline">
                <label class="layui-form-label">按类型搜索</label>
                <div class="layui-input-inline" style="width: 128px;">
                    <select name="flow_type"  lay-search>
                        <option value="">--请选择--</option>
                        {foreach $flowTypeData as $k=>$v}
                        <option value="{$k}">{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">关键词搜索</label>
                <div class="layui-input-inline">
                    <input type="text" name="keywords" autocomplete="off" class="layui-input" placeholder="输入关键词搜索查询">  </div>
            </div>

            <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
                </button>
            </div>
        </form>
        <table class="layui-hide" id="workReportSubmitList" lay-filter="workReportSubmitList"></table>
        <script type="text/html" id="tableBar">
            <div class="layui-btn-group">
                {if $editAuth}<a class="layui-btn layui-btn-sm  layui-btn-normal" lay-event="details">查阅</a>{/if}
            </div>
        </script>
        <script type="text/html" id="is_check_tpl">
            {{# if(d.is_check === 1) { }}<span class="layui-badge layui-bg-cyan">未读</span>{{# } }}
            {{# if(d.is_check === 2) { }}<span class="layui-badge layui-bg-green">己读</span>{{# } }}
        </script>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery, form = layui.form, table = layui.table;
        var tableId = 'workReportSubmitList';
        table.render({
            elem: '#' + tableId,
            id: tableId,
            url: '{:url("propertyApprovalReceivesCopyItToMeList")}',
            toolbar: '#toolbar',
            cols: [[
                {type: "checkbox", width: 50, rowspan: 2},
                {field: 'flow_name', width: 328, title: '标题', rowspan: 2},
                {field: 'flow_type', width: 108, title: '类型', sort: true, rowspan: 2},
                {field: 'is_check', width: 88, title: '状态', sort: true, rowspan: 2, templet:'#is_check_tpl'},
                {field: 'present_username', width: 128, title: '当前审核人', sort: true, rowspan: 2},
                {field: 'remark', minWidth: 168, title: '备注说明', rowspan: 2},
                {title: '操作', width: 168, toolbar: '#tableBar', rowspan: 2, fixed: 'right'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            height: 'full-80'
        });
        form.on('submit(data-search-btn)', function (data) {table.reload(tableId, {page: { curr: 1  }, where: data.field}, 'data'); return false; });
        table.on('rowDouble('+tableId+')', function(obj){
            var data = obj.data;
            var url = '{:url("propertyApprovalReceivesApprovalReadInfo")}?receives_id='+data.id;
            parent.layer.open({
                title: '查阅 ' + data.flow_name, type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['1000px', '100%'],offset:  'rt', anim: 2, content: url , btn: false
            });
        });
        //监听表格复选框选择
        table.on('checkbox('+tableId+')', function (obj) {
            console.log(obj)
        });
        table.on('tool('+tableId+')', function (obj) {
            var data = obj.data;
            if (obj.event === 'details') {
                var url = '{:url("propertyApprovalReceivesApprovalReadInfo")}?receives_id='+data.id;
                var index = parent.layer.open({title: '查阅 ' + data.flow_name, type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['1000px', '100%'],offset:  'rt', anim: 2, content: url , btn:false });
                return false;
            }
        });
    });
</script>
{/block}